
package Componentes;


import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.AbstractAction;
import javax.swing.AbstractCellEditor;
import javax.swing.JSpinner;
import javax.swing.JTable;
import javax.swing.table.TableCellEditor;


public class SpinnerEditor extends AbstractCellEditor implements TableCellEditor,ActionListener{
    protected JSpinner spinner;
    protected Object valor=0;


    public SpinnerEditor() {
        
    }
    
    
    
   
    @Override
    public void actionPerformed(ActionEvent ae) {
       fireEditingStopped();
    }

    @Override
    public Object getCellEditorValue() {
        return this.valor;
    }
    
    @Override
   public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column){
        this.valor=value;
        spinner = new JSpinner();
        valor=Integer.parseInt(""+value);
        spinner.setValue(valor);
        return  spinner;

   }

  
   

}
